<!DOCTYPE HTML>
<html>

<head>
  <meta charset="utf-8">
  <meta name="renderer" content="webkit|ie-comp|ie-stand">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link href="/public/admin/static/h-ui/css/H-ui.css" rel="stylesheet" type="text/css" />
  <link href="/public/admin/static/h-ui.ucenter/css/H-ui.ucenter.css" rel="stylesheet" type="text/css" />
  <title>NodeShop后台登录</title>
</head>
<body>
  <div class="login-wraper">
    <div class="login-form radius box-shadow">

      <div class="row clearfix form-title">NodeShop后台登录</div>
      <form class="form form-horizontal" id="form-login">
        <input type="hidden" name="_csrf" value="<%=csrf%>" />
        <div class="row clearfix">
          <input type="text" class="input-text radius size-L" name="username" id="username" value="" placeholder="请填写用户名">
        </div>
        <div class="row clearfix">
          <input type="password" class="input-text radius size-L" name="password" id="password" value="" placeholder="请填写密码">
        </div>
        <div class="row clearfix">
          <input type="
		password" style="width:165px;" class="input-text radius size-L" name="verity" id="verity"
            value="" placeholder="请填写验证码">
          <img class="verifyImg" style="vertical-align: middle;margin-top: -3px; " onclick="this.src=this.src+'?c='+Math.random();"
            src="/admin/verify" />
        </div>
        <div class="row clearfix">
          <button class="btn btn-primary btn-block radius size-L">登 录</button>
        </div>
        <div class="row clearfix f-12">
          <a href="/password/reset/"></a>
          <div class="line mt-20"></div>
        </div>
        <div class="row clearfix">欢迎使用NodeShop商城系统</div>
      </form>
    </div>
  </div>

  <script type="text/javascript" src="/public/admin/lib/jquery/1.9.1/jquery.min.js"></script>
  <script type="text/javascript" src="/public/admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
  <script type="text/javascript" src="/public/admin/lib/jquery.validation/1.14.0/validate-methods.js"></script>
  <script type="text/javascript" src="/public/admin/lib/jquery.validation/1.14.0/messages_zh.js"></script>
  <script type="text/javascript" src="/public/admin/lib/layer/3.1.1/layer.js"></script>
  <script type="text/javascript">
    $(function () {
      $("#form-login").validate({
        rules: {
          username: {
            required: true
          },
          password: {
            required: true,
            rangelength: [6, 16]
          },
          verity: {
            required: true,
            rangelength: [4, 4]
          }
        },
        messages: {
          username: {
            required: "用户名不能为空"
          },
          password: {
            required: "密码不能为空",
            rangelength: "密码长度为6到16位"
          },
          verity: {
            required: "验证码不能为空",
            rangelength: "验证码长度为4位"
          }
        },
        onkeyup: false,
        focusCleanup: false,
        submitHandler: function (form) {
          $(".label.error").hide();
          $.ajax({
            url: '/admin/dologin',
            type: 'post',
            data: $("#form-login").serialize(),
            success: function (res) {
              layer.msg(res.msg)
              if (res.result == 0) {
                setTimeout(function () {
                  window.location.href = '/admin/manager'
                }, 1000);
              }
            }
          })
        }
      });
    });
  </script>
</body>

</html>